<?
require_once '../classes/LoadProperties.php';
$properties = new LoadProperties();
$properties->initServices();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <script src="../glassboxLatest/glassbox.2.0.0/javascripts/prototype.js" type="text/javascript"></script>
        <script src="../glassboxLatest/glassbox.2.0.0/javascripts/scriptaculous/effects.js" type="text/javascript"></script>
        <script src="../glassboxLatest/glassbox.2.0.0/javascripts/glassbox/glassbox.js" type="text/javascript"></script>
        <style>
            @import url("../css/style.css");


            #disciplinaBox {
                padding-top: 5%;
            }

            #disciplinaBoxCont
            {
                padding-top: 5%;
                padding-top: 1%;
                padding-left: 11%;
            }
            #disciplinaBox_contentBoxBg {
                background-color :  #5767ab;

            }
            #myBox{
                display: none;
            }
            #myBox_content {
                background: url(../images/sfondoContainer.jpg );
                background-color :  #5767ab;
                padding: 20px;
            }
            #myBox h3 {
                font-size: 17px;
                margin: 0px;
                text-align: center
            }

            #inserito
            {
                padding-top: 19px;
                font-size: 14px;
                display: none;
                color: #35ec17;
            }


        </style>
        <script type="text/javascript">
            path_to_root_dir = "../glassboxLatest/glassbox.2.0.0/";
            window.onload = function(){

                var disciplinaBox = new GlassBox();
                disciplinaBox.init( 'disciplinaBox', '400px', '190px', 'hidden','',false);
                disciplinaBox.ipos();
                disciplinaBox.appear();
            }

            function xXMLHttpRequest()
            {

                var client = null;
                if (window.XMLHttpRequest)
                {
                    client=new XMLHttpRequest();
                }
                // code for IE
                else if (window.ActiveXObject)
                {
                    client=new ActiveXObject("Microsoft.XMLHTTP");
                }

                return client;
            }

            function handler() {
                if(this.readyState == 4 && this.status == 200) {
                    if(this.responseText.indexOf("*")!=-1)
                        location.href="../portal/manageErrors.php?lista="+this.responseText;
                    else
                        document.getElementById('inserito').style.display="block";



                } else if (this.readyState == 4 && this.status != 200) {
                    // fetched the wrong page or network error...
                    alert("error this.status : " + this.responseText);

                }
            }

            function submitForm()
            {
                var nome=document.getElementById('nome').value;

                if(nome=="")
                {
                    location.href="../portal/manageErrors.php?noHead=1&lista=6*";
                }
                else
                {
                    var client = xXMLHttpRequest();
                    client.onreadystatechange = handler;
                    var param =
                        "nome="+nome +
                        "&descrizione="+document.getElementById('descrizione').value;
                    client.open("POST", "nuovaDisciplina.php", true);
                    client.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

                    client.send(param);
                }

            }
        </script>
    </head>
    <body>
        <?
        if(!isset ($_GET["disc"]))
            include '../portal/header.php';
        else
        {?>
        <center>
            <a href='javascript:history.go(-1);'><img src='../images/icons/back.ico' height='30' width='30' title='Indietro' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/utente/utente.php?codiceUtente=<?= $_COOKIE['codiceUtente']?>'><img src='../images/icons/PNG/Administrator.png' height='30' width='30' title='<?= $_COOKIE['username']?>' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/portal/newMenu.php'><img src='../images/icons/64/home.png' height='30' width='30' title='Home' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/utente/nuovaClasse.php'><img src='../images/icons/128/school.png' height='30' width='30' title='Nuova classe' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/report/searchStudents.php'><img src='../images/icons/128/people.png' height='30' width='30' title='Studenti' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/testManaging/newArgomento.php?codiceUtente=".$_COOKIE["codiceUtente"] ."'><img src='../images/icons/128/phonebook.png' height='30' width='30' title='Gestione Argomenti' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/testManaging/newQuestion.php'><img src='../images/icons/128/plus.png' height='30' width='30' title='Nuova domanda' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/report/reportQuestions.php'><img src='../images/icons/PNG/Document.png' height='30' width='30' title='Cerca Domande' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/testManaging/newTest_1.php'><img src='../images/icons/128/interact.png' height='30' width='30' title='Nuovo test' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/report/searchTest.php'><img src='../images/icons/128/pencil.png' height='30' width='30' title='Test' border='0'/></a>                
            <a href='<?= $properties->getPath() ?>/testManaging/reportLiveTest.php'><img src='../images/icons/128/vault.png' height='30' width='30' title='Test sottomessi' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/testManaging/reportPdfLiveTest.php'><img src='../images/icons/128/world.png' height='30' width='30' title='Verifica test' border='0'/></a>
            <a href='<?= $properties->getPath() ?>/portal/logout.php'><img src='../images/icons/PNG/logout.png' height='30' width='30' title='Logout' border='0'/></a>
        </center>
            <?}?>
        <center>
            <div id="inserito" ><b>Disciplina correttamente inserita</b></div>
            <div id="disciplinaBox">
                <div id="disciplinaBoxCont">
                    <b><div style="color: red">I campi contrassegnati con "*" sono obbligatori.</div></b><br />

                    <table>
                        <tr>
                            <td>Nome* : </td>
                            <td><input type="text" name="nome" id="nome"/></td>
                        </tr
                        <tr>
                            <td>Descrizione : </td>
                            <td><input type="text" name="descrizione" id="descrizione"/><br></td>
                        </tr>
                        <tr>
                            <td><input type="button" value="Inserisci" onclick="javascript:submitForm();"/></td>
                        </tr>
                    </table>


                </div>
            </div>
            <div id="myBox">Disciplina inserita</div>
        </center>
    </body>
</html>
